﻿<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <script src="../../js/header.js"></script>
    <title>秒付宝-卡管系统</title>
</head>
<body class="login-wbg" id="login">
    <section class="login-wrap">
        <div class="login-icon"><i></i></div>
        <div><p class="login-title">卡管系统</p></div>
        <div class="login-cont">
            <div class="container-fluid">
                <div class="row">

                    <div class="col-md-12">
                        <label>用户名</label>
                        <input type="text" name="account" class="form-control" placeholder="用户名"/>
                    </div>

                    <div class="col-md-12 p15_t">
                        <label>密码</label>
                        <input type="password" name="password" class="form-control" placeholder="密码"/>
                    </div>

                    <div class="col-md-12 p15_t">
                    </div>

                    <div class="col-md-4 text-right"></div>
                    <div class="col-md-12 p20_t">
                        <button class="btn btn-block btn-primary btn-lg" onclick="return login()">登&nbsp;录</button>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <script type="text/javascript">
        function login() {
            var data = {
                "account": $("input[name='account']").val(),
                "password": $("input[name='password']").val()
            };
            var cover = FlashPay.UI.Mask({
                obj: $("#login"),
                opacity: 0.5
            });
            $.post("/account/Authorize", data, function (a) {
                if (a.success) {
                    FlashPay.UI.Tip_success("登录成功！");
                    $.cookie('username', a.data.userName);
                    $.cookie('companyname', a.data.companyName);
                    $.cookie('token', a.data.token);
                    window.location.href = "/index.html"
                } else {
                    cover.Remove();
                    FlashPay.UI.Tip_danger(a.errorMessage)
                }
            });
        }

        $(document).keyup(function (event) {
            var keycode = event.which;
            if (keycode == 13) {
                login();
            }
        }); 
    </script>
</body>
</html>